Current File : /home/jeconsul/public_html/wp-content/plugins/sureforms/assets/build/formSubmit.js
/*! For license information please see formSubmit.js.LICENSE.txt */
(()=>{"use strict";const t=window.wp.hooks;function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}function r(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function n(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?r(Object(n),!0).forEach((function(e){o(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function o(t,r,n){return(r=function(t){var r=function(t,r){if("object"!==e(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,"string");if("object"!==e(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===e(r)?r:String(r)}(r))in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,t}function i(){i=function(){return t};var t={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},l=a.iterator||"@@iterator",s=a.asyncIterator||"@@asyncIterator",u=a.toStringTag||"@@toStringTag";function c(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{c({},"")}catch(t){c=function(t,e,r){return t[e]=r}}function f(t,e,r,n){var i=e&&e.prototype instanceof v?e:v,a=Object.create(i.prototype),l=new A(n||[]);return o(a,"_invoke",{value:k(t,r,l)}),a}function d(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=f;var m={};function v(){}function p(){}function h(){}var y={};c(y,l,(function(){return this}));var b=Object.getPrototypeOf,g=b&&b(b(O([])));g&&g!==r&&n.call(g,l)&&(y=g);var w=h.prototype=v.prototype=Object.create(y);function S(t){["next","throw","return"].forEach((function(e){c(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,r){function i(o,a,l,s){var u=d(t[o],t,a);if("throw"!==u.type){var c=u.arg,f=c.value;return f&&"object"==e(f)&&n.call(f,"__await")?r.resolve(f.__await).then((function(t){i("next",t,l,s)}),(function(t){i("throw",t,l,s)})):r.resolve(f).then((function(t){c.value=t,l(c)}),(function(t){return i("throw",t,l,s)}))}s(u.arg)}var a;o(this,"_invoke",{value:function(t,e){function n(){return new r((function(r,n){i(t,e,r,n)}))}return a=a?a.then(n,n):n()}})}function k(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var l=x(a,r);if(l){if(l===m)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=d(t,e,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===m)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}function x(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,x(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),m;var o=d(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,m;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,m):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,m)}function L(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(L,this),this.reset(!0)}function O(t){if(t){var e=t[l];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:j}}function j(){return{value:void 0,done:!0}}return p.prototype=h,o(w,"constructor",{value:h,configurable:!0}),o(h,"constructor",{value:p,configurable:!0}),p.displayName=c(h,u,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===p||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,h):(t.__proto__=h,c(t,u,"GeneratorFunction")),t.prototype=Object.create(w),t},t.awrap=function(t){return{__await:t}},S(E.prototype),c(E.prototype,s,(function(){return this})),t.AsyncIterator=E,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new E(f(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},S(w),c(w,u,"Generator"),c(w,l,(function(){return this})),c(w,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=O,A.prototype={constructor:A,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var l=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(l&&s){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),_(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;_(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:O(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),m}},t}function a(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return l(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}function l(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function s(t,e,r,n,o,i,a){try{var l=t[i](a),s=l.value}catch(t){return void r(t)}l.done?e(s):Promise.resolve(s).then(n,o)}function u(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){s(i,n,o,a,l,"next",t)}function l(t){s(i,n,o,a,l,"throw",t)}a(void 0)}))}}function c(t,e,r,n){return f.apply(this,arguments)}function f(){return(f=u(i().mark((function t(e,r,n,o){var a,l,s;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a="action=validation_ajax_action&nonce="+encodeURIComponent(o)+"&id="+encodeURIComponent(r),Object.keys(e).forEach((function(t){a+="&"+encodeURIComponent(t)+"="+encodeURIComponent(e[t])})),t.prev=2,t.next=5,fetch(n,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:a});case 5:if(!(l=t.sent).ok){t.next=11;break}return t.next=9,l.json();case 9:return s=t.sent,t.abrupt("return",s.data);case 11:t.next=16;break;case 13:t.prev=13,t.t0=t.catch(2),console.error(t.t0);case 16:case"end":return t.stop()}}),t,null,[[2,13]])})))).apply(this,arguments)}function d(t,e,r,n){return m.apply(this,arguments)}function m(){return m=u(i().mark((function e(r,o,l,s){var u,f,d,m,v,p,h,y,b,g,w,S,E,k,x,L,_,A,O=arguments;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(u=O.length>4&&void 0!==O[4]&&O[4],f=!1,d=null,m=null,v={},p=function(t,e){d||(d=t,m=e,v=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{})},h=null,0===(y=document.querySelectorAll('input[data-unique="true"]')).length){e.next=15;break}b={},g=a(y);try{for(g.s();!(w=g.n()).done;)S=w.value,E=S.name,k=S.value,b[E]=k}catch(t){g.e(t)}finally{g.f()}return e.next=14,c(b,r,o,l);case 14:h=e.sent;case 15:x=u?[s]:Array.from(s.querySelectorAll(".srfm-block-single")),L=a(x),e.prev=17,A=i().mark((function e(){var n,o,a,l,s,u,c,d,m,v,y,b,g,w,S,E,k,x,L,A,O,j,q,C,P,T,I,F,N,D,G,R,U,M,B,H,Y,V,z,K,$,W,Z,J,Q,X,tt,et,rt,nt,ot,it,at,lt,st,ut,ct,ft,dt,mt,vt,pt,ht,yt,bt,gt,wt,St,Et,kt,xt,Lt,_t,At,Ot,jt,qt,Ct,Pt,Tt,It,Ft,Nt,Dt,Gt,Rt,Ut,Mt,Bt,Ht,Yt,Vt,zt,Kt,$t,Wt,Zt,Jt,Qt,Xt,te,ee,re,ne,oe,ie,ae,le,se,ue,ce,fe,de,me,ve,pe,he,ye,be,ge,we,Se,Ee;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(l=_.value,s=!1,Array.isArray(null===(n=window.sureforms)||void 0===n?void 0:n.skipValidationCallbacks)&&window.sureforms.skipValidationCallbacks.forEach((function(t){"function"==typeof t&&(s=s||t(l))})),!s){e.next=5;break}return e.abrupt("return","continue");case 5:if(l.closest("form").getAttribute("form-id")===r){e.next=9;break}return e.abrupt("return","continue");case 9:e.t0=!0,e.next=e.t0===l.classList.contains("srfm-phone-block")?12:15;break;case 12:return u=l.querySelector(".srfm-input-phone"),c=null===(o=u)||void 0===o||null===(a=o.nextElementSibling)||void 0===a?void 0:a.value,e.abrupt("break",18);case 15:return u=l.querySelector("input, textarea, select"),c=u.value,e.abrupt("break",18);case 18:if(d=u.getAttribute("data-required"),m=u.getAttribute("data-unique"),v=u.getAttribute("name"),y=l.querySelector(".srfm-error-message"),v&&(v=v.replace(/_/g," ")),d&&"hidden"!==u.type&&("true"!==d||c?u&&(null===(w=window)||void 0===w||null===(S=w.srfm)||void 0===S||S.toggleErrorState(u.closest(".srfm-block"),!1)):(u&&(null===(b=window)||void 0===b||null===(g=b.srfm)||void 0===g||g.toggleErrorState(u.closest(".srfm-block"),!0)),y&&(y.textContent=y.getAttribute("data-error-msg")),f=!0,p(u,u.closest(".srfm-block"))),u.addEventListener("input",(function(){var t,e;null===(t=window)||void 0===t||null===(e=t.srfm)||void 0===e||e.toggleErrorState(u.closest(".srfm-block"),!1)}))),"true"===m&&""!==c&&((null===(E=h)||void 0===E?void 0:E.some((function(t){return"not unique"===t[v]})))?(u&&(null===(k=window)||void 0===k||null===(x=k.srfm)||void 0===x||x.toggleErrorState(u.closest(".srfm-block"),!0)),y.style.display="block",y.textContent=y.getAttribute("data-unique-msg"),f=!0,p(u,u.closest(".srfm-block"))):u&&(null===(L=window)||void 0===L||null===(A=L.srfm)||void 0===A||A.toggleErrorState(u.closest(".srfm-block"),!1),y.style.display="none")),!(l.classList.contains("srfm-multi-choice-block")||l.classList.contains("srfm-checkbox-block")||l.classList.contains("srfm-gdpr-block"))){e.next=41;break}O=l.querySelectorAll("input"),j=O[0].getAttribute("data-required"),q=!1,C=null,P=0;case 31:if(!(P<O.length)){e.next=39;break}if(C||"hidden"===O[P].type||(C=O[P]),!O[P].checked){e.next=36;break}return q=!0,e.abrupt("break",39);case 36:P++,e.next=31;break;case 39:"true"!==j||q?y&&(null===(F=window)||void 0===F||null===(N=F.srfm)||void 0===N||N.toggleErrorState(l,!1)):(y&&(y.textContent=l.querySelector(".srfm-error-message").getAttribute("data-error-msg"),null===(T=window)||void 0===T||null===(I=T.srfm)||void 0===I||I.toggleErrorState(l,!0)),f=!0,p(C,l)),O.forEach((function(t){t.addEventListener("input",(function(){var t,e;null===(t=window)||void 0===t||null===(e=t.srfm)||void 0===e||e.toggleErrorState(l,!1)}))}));case 41:if(l.classList.contains("srfm-url-block")&&(D=l.querySelector("input"),l.classList.contains("srfm-url-error")&&(null===(G=window)||void 0===G||null===(R=G.srfm)||void 0===R||R.toggleErrorState(l,!0),f=!0,p(D,l)),D.addEventListener("input",(function(){var t,e;null===(t=window)||void 0===t||null===(e=t.srfm)||void 0===e||e.toggleErrorState(l,!1)}))),l.classList.contains("srfm-phone-block")&&(U=l.querySelectorAll("input")[1],l.classList.contains("srfm-phone-error")&&(null===(M=window)||void 0===M||null===(B=M.srfm)||void 0===B||B.toggleErrorState(l,!0),f=!0,p(U,l)),l.querySelectorAll("input").forEach((function(t){t.addEventListener("input",(function(){var t,e;null===(t=window)||void 0===t||null===(e=t.srfm)||void 0===e||e.toggleErrorState(l,!1)}))}))),l.classList.contains("srfm-password-block-wrap")&&(H=l)&&(Y=H.querySelector(".srfm-password-confirm-block"))&&(V=Y.querySelector(".srfm-input-password-confirm").value,z=Y.querySelector(".srfm-error-message"),!V&&z&&"true"===d?(z.textContent=z.getAttribute("data-error-msg"),null===(K=window)||void 0===K||null===($=K.srfm)||void 0===$||$.toggleErrorState(Y,!0),p(V,Y),f=!0):V!==c?(null===(W=window)||void 0===W||null===(Z=W.srfm)||void 0===Z||Z.toggleErrorState(Y,!0),z.textContent=null===(J=window)||void 0===J||null===(Q=J.srfm_submit)||void 0===Q||null===(X=Q.messages)||void 0===X?void 0:X.srfm_confirm_password_same,p(V,Y),f=!0):null===(tt=window)||void 0===tt||null===(et=tt.srfm)||void 0===et||et.toggleErrorState(Y,!1)),l.classList.contains("srfm-email-block-wrap")&&(rt=l)&&(nt=rt.querySelector(".srfm-email-confirm-block"),rt.classList.contains("srfm-valid-email-error")&&(p(u,rt),f=!0),nt&&(ot=nt.querySelector(".srfm-input-email-confirm"),it=nt.querySelector(".srfm-input-email-confirm").value,at=nt.querySelector(".srfm-error-message"),!it&&at&&"true"===d?(at.textContent=at.getAttribute("data-error-msg"),null===(lt=window)||void 0===lt||null===(st=lt.srfm)||void 0===st||st.toggleErrorState(nt,!0),p(ot,nt),f=!0):it!==c?(null===(ut=window)||void 0===ut||null===(ct=ut.srfm)||void 0===ct||ct.toggleErrorState(nt,!0),at.textContent=null===(ft=window)||void 0===ft||null===(dt=ft.srfm_submit)||void 0===dt||null===(mt=dt.messages)||void 0===mt?void 0:mt.srfm_confirm_email_same,p(ot,nt),f=!0):null===(vt=window)||void 0===vt||null===(pt=vt.srfm)||void 0===pt||pt.toggleErrorState(nt,!1),ot.addEventListener("input",(function(){var t,e;null===(t=window)||void 0===t||null===(e=t.srfm)||void 0===e||e.toggleErrorState(nt,!1)}))),rt.querySelector(".srfm-input-email").addEventListener("input",(function(){var t,e;null===(t=window)||void 0===t||null===(e=t.srfm)||void 0===e||e.toggleErrorState(rt,!1)}))),l.classList.contains("srfm-upload-block")&&(ht=l.querySelector(".srfm-input-upload"),"true"!==(yt=ht.getAttribute("data-required"))||ht.value?u&&(null===(wt=window)||void 0===wt||null===(St=wt.srfm)||void 0===St||St.toggleErrorState(u.closest(".srfm-block"),!1)):("true"===yt&&y&&(y.textContent=y.getAttribute("data-error-msg")),u&&(null===(bt=window)||void 0===bt||null===(gt=bt.srfm)||void 0===gt||gt.toggleErrorState(u.closest(".srfm-block"),!0)),f=!0,p(ht,l)),ht.addEventListener("input",(function(){var t,e;u&&(null===(t=window)||void 0===t||null===(e=t.srfm)||void 0===e||e.toggleErrorState(u.closest(".srfm-block"),!1))}))),l.classList.contains("srfm-number-block")&&(Et=u.getAttribute("min"),kt=u.getAttribute("max"),xt=u.getAttribute("format-type"),c&&(Lt="eu-style"===xt?parseFloat(c.replace(/\./g,"").replace(",",".")):parseFloat(c.replace(/,/g,"")),(Et||kt)&&(Ot=!1,jt="",Et&&""!==Et&&Number(Lt)<Number(Et)?(Ot=!0,jt=null===(qt=window)||void 0===qt||null===(Ct=qt.srfm)||void 0===Ct?void 0:Ct.srfmSprintfString(null===(Pt=window)||void 0===Pt||null===(Tt=Pt.srfm_submit)||void 0===Tt||null===(It=Tt.messages)||void 0===It?void 0:It.srfm_input_min_value,Et)):kt&&""!==kt&&Number(Lt)>Number(kt)&&(Ot=!0,jt=null===(Ft=window)||void 0===Ft||null===(Nt=Ft.srfm)||void 0===Nt?void 0:Nt.srfmSprintfString(null===(Dt=window)||void 0===Dt||null===(Gt=Dt.srfm_submit)||void 0===Gt||null===(Rt=Gt.messages)||void 0===Rt?void 0:Rt.srfm_input_max_value,kt)),null===(_t=window)||void 0===_t||null===(At=_t.srfm)||void 0===At||At.toggleErrorState(u.closest(".srfm-block"),Ot),y&&(y.textContent=Ot?jt:"",Ot&&(f=!0,p(u,l)))))),l.classList.contains("srfm-rating-block")&&("true"!==(Ut=l.querySelector(".srfm-input-rating")).getAttribute("data-required")||Ut.value?null===(Ht=window)||void 0===Ht||null===(Yt=Ht.srfm)||void 0===Yt||Yt.toggleErrorState(Ut.closest(".srfm-block"),!1):(null===(Mt=window)||void 0===Mt||null===(Bt=Mt.srfm)||void 0===Bt||Bt.toggleErrorState(Ut.closest(".srfm-block"),!0),f=!0,p(l.querySelector(".srfm-icon"),l))),l.classList.contains("srfm-slider-block")&&(Vt=l.getAttribute("data-required"),zt=l.querySelector(".srfm-input-slider"),Kt=l.querySelector(".srfm-text-slider"),$t=l.getAttribute("data-default"),"true"===Vt&&(Wt=!1,(!zt||zt.dataset.interacted||$t&&"false"!==$t)&&(!Kt||Kt.dataset.interacted||$t&&"false"!==$t)||(Wt=!0),Wt?(null===(Zt=window)||void 0===Zt||null===(Jt=Zt.srfm)||void 0===Jt||Jt.toggleErrorState(l,!0),f=!0,p(zt,l)):null===(Qt=window)||void 0===Qt||null===(Xt=Qt.srfm)||void 0===Xt||Xt.toggleErrorState(l,!1))),l.classList.contains("srfm-dropdown-block")&&(te=l.querySelectorAll(".srfm-input-dropdown-hidden"),ee=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver,te.forEach((function(t){var e,r,n=t.getAttribute("data-required"),o=t.getAttribute("name");if("true"!==n||t.value)if(t.value){var i=t.getAttribute("data-min-selection"),a=t.getAttribute("data-max-selection");if(i||a){var l,s,u,c,d,m,v,h=t.value.split(",");if(i&&h.length<i)y.textContent=null===(l=window)||void 0===l||null===(s=l.srfm)||void 0===s?void 0:s.srfmSprintfString(null===(u=window)||void 0===u||null===(c=u.srfm_submit)||void 0===c||null===(d=c.messages)||void 0===d?void 0:d.srfm_dropdown_min_selections,i),null===(m=window)||void 0===m||null===(v=m.srfm)||void 0===v||v.toggleErrorState(t.closest(".srfm-block"),!0),f=!0;else if(a&&h.length>a){var b,g,w,S,E,k,x;y.textContent=null===(b=window)||void 0===b||null===(g=b.srfm)||void 0===g?void 0:g.srfmSprintfString(null===(w=window)||void 0===w||null===(S=w.srfm_submit)||void 0===S||null===(E=S.messages)||void 0===E?void 0:E.srfm_dropdown_max_selections,a),null===(k=window)||void 0===k||null===(x=k.srfm)||void 0===x||x.toggleErrorState(t.closest(".srfm-block"),!0),f=!0}}}else{var L,_;null===(L=window)||void 0===L||null===(_=L.srfm)||void 0===_||_.toggleErrorState(t.closest(".srfm-block"),!1)}else y.textContent=y.getAttribute("data-error-msg"),null===(e=window)||void 0===e||null===(r=e.srfm)||void 0===r||r.toggleErrorState(t.closest(".srfm-block"),!0),f=!0;if(f){var A,O,j=(null===(A=window)||void 0===A||null===(O=A.srfm)||void 0===O?void 0:O[o])||t;p(j,t.closest(".srfm-block"),{shouldDelayOnFocus:!0})}new ee((function(){var e,r;if(t.value)null===(e=window)||void 0===e||null===(r=e.srfm)||void 0===r||r.toggleErrorState(t.closest(".srfm-block"),!1);else if("true"===n){var o,i;null===(o=window)||void 0===o||null===(i=o.srfm)||void 0===i||i.toggleErrorState(t.closest(".srfm-block"),!0)}})).observe(t,{attributes:!0,attributeFilter:["value"]})}))),l.classList.contains("srfm-multi-choice-block")){for(re=l.querySelectorAll("input"),ne=re[0].getAttribute("data-min-selection"),oe=re[0].getAttribute("data-max-selection"),ie=null,ae=0,le=!1,se=0;se<re.length;se++)ie||"hidden"===re[se].type||(ie=re[se]),re[se].checked&&ae++;(ne||oe)&&ae>0&&(!le&&ne>0&&(d&&ne>1||!d)&&ae<ne&&(y.textContent=null===(ue=window)||void 0===ue||null===(ce=ue.srfm)||void 0===ce?void 0:ce.srfmSprintfString(null===(fe=window)||void 0===fe||null===(de=fe.srfm_submit)||void 0===de||null===(me=de.messages)||void 0===me?void 0:me.srfm_multi_choice_min_selections,ne),le=!0),!le&&oe>0&&ae>oe&&(y.textContent=null===(ve=window)||void 0===ve||null===(pe=ve.srfm)||void 0===pe?void 0:pe.srfmSprintfString(null===(he=window)||void 0===he||null===(ye=he.srfm_submit)||void 0===ye||null===(be=ye.messages)||void 0===be?void 0:be.srfm_multi_choice_max_selections,oe),le=!0),le?(null===(ge=window)||void 0===ge||null===(we=ge.srfm)||void 0===we||we.toggleErrorState(l,!0),p(ie,l),f=!0):d||null===(Se=window)||void 0===Se||null===(Ee=Se.srfm)||void 0===Ee||Ee.toggleErrorState(l,!1))}f=(0,t.applyFilters)("srfm.modifyFieldValidationResult",f,l,p);case 52:case"end":return e.stop()}}),e)})),L.s();case 20:if((_=L.n()).done){e.next=27;break}return e.delegateYield(A(),"t0",22);case 22:if("continue"!==e.t0){e.next=25;break}return e.abrupt("continue",25);case 25:e.next=20;break;case 27:e.next=32;break;case 29:e.prev=29,e.t1=e.catch(17),L.e(e.t1);case 32:return e.prev=32,L.f(),e.finish(32);case 35:return e.abrupt("return",!!f&&n({validateResult:f,firstErrorInput:d,scrollElement:m},v));case 36:case"end":return e.stop()}}),e,null,[[17,29,32,35]])}))),m.apply(this,arguments)}var v=function(){var t=u(i().mark((function t(e,r){var n,o,a,l,s;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.closest(r),o=n.closest("form"),a=o.getAttribute("form-id"),l=o.getAttribute("ajaxurl"),s=o.getAttribute("data-nonce"),t.next=8,d(a,l,s,n,!0);case 8:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}(),p=function(t){if(null!=t&&t.firstErrorInput){if(null!=t&&t.scrollElement){var e=t.scrollElement.getBoundingClientRect().top+window.pageYOffset-window.innerHeight/2;window.scroll({top:e,behavior:"smooth"})}null!=t&&t.shouldDelayOnFocus?setTimeout((function(){t.firstErrorInput.focus({preventScroll:!0})}),500):t.firstErrorInput.focus({preventScroll:!0})}},h=function(t,e,r,n){if(!(t||e||r||n))return!0;var o;"v2-checkbox"===t?o=grecaptcha.getResponse():e?o=hcaptcha.getResponse():r&&(o=turnstile.getResponse());var i=o.length>0;return n.style.display=i?"none":"block",i};const y=window.wp.i18n;function b(t){return b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},b(t)}function g(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function w(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?g(Object(r),!0).forEach((function(e){S(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):g(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function S(t,e,r){return(e=function(t){var e=function(t,e){if("object"!==b(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!==b(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===b(e)?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function E(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=k(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,l=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){l=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(l)throw i}}}}function k(t,e){if(t){if("string"==typeof t)return x(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?x(t,e):void 0}}function x(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function L(){L=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n=Object.defineProperty||function(t,e,r){t[e]=r.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function u(t,e,r,o){var i=e&&e.prototype instanceof d?e:d,a=Object.create(i.prototype),l=new A(o||[]);return n(a,"_invoke",{value:E(t,r,l)}),a}function c(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var f={};function d(){}function m(){}function v(){}var p={};s(p,i,(function(){return this}));var h=Object.getPrototypeOf,y=h&&h(h(O([])));y&&y!==e&&r.call(y,i)&&(p=y);var g=v.prototype=d.prototype=Object.create(p);function w(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function S(t,e){function o(n,i,a,l){var s=c(t[n],t,i);if("throw"!==s.type){var u=s.arg,f=u.value;return f&&"object"==b(f)&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){o("next",t,a,l)}),(function(t){o("throw",t,a,l)})):e.resolve(f).then((function(t){u.value=t,a(u)}),(function(t){return o("throw",t,a,l)}))}l(s.arg)}var i;n(this,"_invoke",{value:function(t,r){function n(){return new e((function(e,n){o(t,r,e,n)}))}return i=i?i.then(n,n):n()}})}function E(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var l=k(a,r);if(l){if(l===f)continue;return l}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=c(t,e,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===f)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}function k(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,k(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),f;var o=c(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,f;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function O(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:j}}function j(){return{value:void 0,done:!0}}return m.prototype=v,n(g,"constructor",{value:v,configurable:!0}),n(v,"constructor",{value:m,configurable:!0}),m.displayName=s(v,l,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===m||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,v):(t.__proto__=v,s(t,l,"GeneratorFunction")),t.prototype=Object.create(g),t},t.awrap=function(t){return{__await:t}},w(S.prototype),s(S.prototype,a,(function(){return this})),t.AsyncIterator=S,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new S(u(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(g),s(g,l,"Generator"),s(g,i,(function(){return this})),s(g,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=O,A.prototype={constructor:A,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(_),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var l=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(l&&s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,f):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),f},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),_(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;_(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:O(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}function _(t,e,r,n,o,i,a){try{var l=t[i](a),s=l.value}catch(t){return void r(t)}l.done?e(s):Promise.resolve(s).then(n,o)}function A(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){_(i,n,o,a,l,"next",t)}function l(t){_(i,n,o,a,l,"throw",t)}a(void 0)}))}}function O(t){var e=t.querySelectorAll(".srfm-address-block");if(!e)return null;var r={};return e.forEach((function(t){var e=t.getAttribute("data-slug");if(e){var n=t.querySelectorAll(".srfm-input-input, .srfm-dropdown-input"),o=Array.from(n).map((function(t){var e;return null==t||null===(e=t.value)||void 0===e?void 0:e.trim()})).filter(Boolean).join(", ");r[e]=o}})),Object.keys(r).length>0?r:null}function j(t){return q.apply(this,arguments)}function q(){return(q=A(L().mark((function t(e){var r,n,o,i,a,l,s,u,c,f,d;return L().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r=new FormData(e),n=new FormData,o=["srfm-email-confirm","srfm-password-confirm"],i=E(r.entries()),t.prev=4,i.s();case 6:if((a=i.n()).done){t.next=14;break}if(m=a.value,v=2,l=function(t){if(Array.isArray(t))return t}(m)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,l=[],s=!0,u=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=i.call(r)).done)&&(l.push(n.value),l.length!==e);s=!0);}catch(t){u=!0,o=t}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw o}}return l}}(m,v)||k(m,v)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),s=l[0],u=l[1],!o.includes(s)){t.next=10;break}return t.abrupt("continue",12);case 10:""!==u&&(c=e.querySelector('[name="'.concat(s,'"]')),null!=(f=null==c?void 0:c.closest(".srfm-block-single"))&&f.classList.contains("hide-element")&&(u="")),n.append(s,u);case 12:t.next=6;break;case 14:t.next=19;break;case 16:t.prev=16,t.t0=t.catch(4),i.e(t.t0);case 19:return t.prev=19,i.f(),t.finish(19);case 22:return(d=O(e))&&n.append("srfm_addresses",JSON.stringify(d)),t.prev=24,t.next=27,wp.apiFetch({path:"sureforms/v1/submit-form",method:"POST",body:n});case 27:return t.abrupt("return",t.sent);case 30:t.prev=30,t.t1=t.catch(24),console.log(t.t1);case 33:case"end":return t.stop()}var m,v}),t,null,[[4,16,19,22],[24,30]])})))).apply(this,arguments)}function C(t){return P.apply(this,arguments)}function P(){return(P=A(L().mark((function t(e){var r;return L().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.data.submission_id,t.prev=1,t.next=4,wp.apiFetch({path:"/sureforms/v1/after-submission/".concat(r),method:"GET"});case 4:t.next=9;break;case 6:t.prev=6,t.t0=t.catch(1),console.error(t.t0);case 9:case"end":return t.stop()}}),t,null,[[1,6]])})))).apply(this,arguments)}function T(e,r,n,o,i,a,l){var s,u,c=new CustomEvent("srfm_on_show_success_message",{cancelable:!0,detail:{form:o,element:r,message:n,submitType:a,container:e,loader:l}});document.dispatchEvent(c)&&("hide form"===i?(o.style.opacity=1,o.style.display="none",setTimeout((function(){r.style.opacity=1}),500)):"reset form"===i&&o.reset(),r.innerHTML=n,e.classList.add("srfm-active"),null===(s=window)||void 0===s||null===(u=s.srfm)||void 0===u||u.handleInstantFormWrapperHeight(),(0,t.applyFilters)("srfm.enableScrollOnSuccess",!0)&&o.parentElement.scrollIntoView({behavior:"smooth"}))}function I(t){var e=t.form,r=t.message,n=void 0===r?"":r,o=t.position,i=new CustomEvent("srfm_show_common_form_error",{detail:{form:e,message:n,position:void 0===o?"footer":o}});document.dispatchEvent(i)}function F(t){t.querySelectorAll(".srfm-common-error-message").forEach((function(t){t.setAttribute("hidden",!0)}))}function N(t,e,r,n,o,i,a,l,s,u,c,f,d,m){return D.apply(this,arguments)}function D(){return(D=A(L().mark((function t(e,r,n,o,i,a,l,s,u,c,f,m,v,y){var b,g,S,E,k,x,_,A,O;return L().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,i.classList.add("srfm-active"),F(e),t.next=5,d(r,n,o,e);case 5:if(b=t.sent,g=h(f,m,v,y),(null==b||!b.validateResult)&&g){t.next=11;break}return i.classList.remove("srfm-active"),null!=b&&b.validateResult?p(b):g||p({firstErrorInput:y,scrollElement:y}),t.abrupt("return");case 11:if(S=new CustomEvent("srfm_on_trigger_form_submission",{cancelable:!0,detail:{form:e,loader:i,formId:r,submitType:u,successElement:s,successContainer:l}}),document.dispatchEvent(S)){t.next=15;break}return i.classList.remove("srfm-active"),t.abrupt("return");case 15:return t.next=17,j(e);case 17:null!=(E=t.sent)&&E.success?(R(w(w({},E),{},{formId:r})),"same page"===u?(T(l,s,null!==(x=null==E?void 0:E.message)&&void 0!==x?x:"",e,c,u),i.classList.remove("srfm-active")):["different page","custom url"].includes(u)?(null!=E&&E.redirect_url&&(a=null==E?void 0:E.redirect_url,window.location.assign(a)),i.classList.remove("srfm-active")):T(l,s,null!==(_=null==E?void 0:E.message)&&void 0!==_?_:"",e,c,u,i),null!=E&&null!==(k=E.data)&&void 0!==k&&k.after_submit&&C(E)):(A=(null==E?void 0:E.data)||{},I(w({form:e},A)),i.classList.remove("srfm-active")),t.next=27;break;case 21:t.prev=21,t.t0=t.catch(0),O=new CustomEvent("srfm_on_trigger_form_submission_failure",{detail:{form:e,error:t.t0,loader:i,formId:r,submitType:u,successElement:s,successContainer:l}}),document.dispatchEvent(O),i.classList.remove("srfm-active"),I({form:e});case 27:case"end":return t.stop()}var a}),t,null,[[0,21]])})))).apply(this,arguments)}function G(t){var e=t.getAttribute("form-id"),r=t.getAttribute("message-type"),n=t.getAttribute("success-url"),o=t.getAttribute("ajaxurl"),i=t.getAttribute("data-nonce"),a=t.querySelector(".srfm-loader"),l=t.parentElement.querySelector(".srfm-single-form.srfm-success-box"),s=null==l?void 0:l.querySelector(".srfm-success-box-description"),u=t.querySelector("#srfm-submit-btn"),c=t.getAttribute("after-submission"),f=t.querySelector(".g-recaptcha");return{formId:e,submitType:r,successUrl:n,ajaxUrl:o,nonce:i,loader:a,successContainer:l,successElement:s,submitBtn:u,siteKey:null==f?void 0:f.getAttribute("data-sitekey"),recaptchaType:null==f?void 0:f.getAttribute("recaptcha-type"),afterSubmission:c,captchaErrorElement:t.querySelector("#captcha-error"),hCaptchaDiv:t.querySelector(".h-captcha"),turnstileDiv:t.querySelector(".cf-turnstile")}}function R(t){var e=new CustomEvent("srfm_form_submission_success",{detail:{formId:"srfm-form-".concat(t.formId)}});document.dispatchEvent(e)}document.addEventListener("DOMContentLoaded",(function(){["srfm-input-block","srfm-email-block-wrap","srfm-url-block","srfm-phone-block","srfm-checkbox-block","srfm-gdpr-block","srfm-number-block","srfm-multi-choice-block","srfm-datepicker-block","srfm-upload-block","srfm-rating-block","srfm-textarea-block","srfm-dropdown-block","srfm-slider-block"].forEach((function(t){return function(t,e){var r=Array.from(document.getElementsByClassName(t));if(r){var n,o=a(r);try{var l=function(){var r=n.value,o=r.querySelector("input")||r.querySelector("textarea")||r.querySelector("select");if("srfm-upload-block"===t&&(o=r.querySelector('input[type="file"]')),"srfm-rating-block"===t&&function(t,e,r){e.querySelectorAll(".srfm-icon").forEach((function(t){t.addEventListener("blur",u(i().mark((function e(){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:v(t,r);case 1:case"end":return e.stop()}}),e)}))))}))}(0,r,e),"srfm-multi-choice-block"===t&&function(t,e,r){e.querySelectorAll(".srfm-input-multi-choice-single").forEach((function(t){t.addEventListener("blur",u(i().mark((function e(){return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:v(t,r);case 1:case"end":return e.stop()}}),e)}))))}))}(0,r,e),"srfm-email-block-wrap"===t&&function(t,e){var r=t.querySelectorAll("input"),n=t.closest(e);r.forEach((function(t){t.addEventListener("input",u(i().mark((function e(){var r,o,a,l,s,u,c,f,d,m,v,p,h,y,b,g;return i().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.value=t.value.trim().toLowerCase(),r=!1,/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(t.value)&&(r=!0),o=t.classList.contains("srfm-input-email-confirm")?n.querySelector(".srfm-email-confirm-block"):n.querySelector(".srfm-email-block"),a=o.querySelector(".srfm-error-message"),t.value||(a.style.display="none",o.classList.remove("srfm-valid-email-error")),!t.classList.contains("srfm-input-email-confirm")){e.next=20;break}if(u=n.querySelector(".srfm-input-email"),c=n.querySelector(".srfm-email-confirm-block"),f=c.querySelector(".srfm-error-message"),u.value===t.value){e.next=17;break}return f.style.display="block",f.textContent=null===(d=window)||void 0===d||null===(m=d.srfm_submit)||void 0===m||null===(v=m.messages)||void 0===v?void 0:v.srfm_confirm_email_same,null===(p=window)||void 0===p||null===(h=p.srfm)||void 0===h||h.toggleErrorState(n,!0),e.abrupt("return");case 17:null===(l=window)||void 0===l||null===(s=l.srfm)||void 0===s||s.toggleErrorState(n,!1),f.textContent="",f.style.display="none";case 20:""===(null==t?void 0:t.value)||r?(a.style.display="none",o.parentElement.classList.remove("srfm-valid-email-error"),a.removeAttribute("id")):(o.parentElement.classList.add("srfm-valid-email-error"),a.style.display="block",a.innerHTML=null===(y=window)||void 0===y||null===(b=y.srfm_submit)||void 0===b||null===(g=b.messages)||void 0===g?void 0:g.srfm_valid_email,a.id=a.getAttribute("data-srfm-id"));case 21:case"end":return e.stop()}}),e)}))))}))}(r,e),"srfm-slider-block"===t&&function(t,e,r){var n=e.querySelector(".srfm-input-slider"),o=e.querySelector(".srfm-text-slider");if(n&&n.addEventListener("blur",u(i().mark((function t(){return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:v(n,r);case 1:case"end":return t.stop()}}),t)})))),o){var a=o.querySelector(".srfm-slider-thumb");a&&a.addEventListener("blur",u(i().mark((function t(){return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:v(a,r);case 1:case"end":return t.stop()}}),t)}))))}}(0,r,e),"srfm-dropdown-block"===t){var a=o.getAttribute("name");setTimeout((function(){var t,r,n;null===(t=window)||void 0===t||null===(r=t.srfm)||void 0===r||null===(n=r[a])||void 0===n||n.on("blur",(function(){v(o,e)}))}),500)}"srfm-phone-block"===t&&(o=r.querySelector(".srfm-input-phone")),o&&o.addEventListener("blur",u(i().mark((function t(){return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:v(o,e);case 1:case"end":return t.stop()}}),t)}))))};for(o.s();!(n=o.n()).done;)l()}catch(t){o.e(t)}finally{o.f()}}}(t,".".concat(t))})),document.querySelectorAll(".srfm-multi-choice-block").forEach((function(t){var e,r,n=t.querySelector(".srfm-input-multi-choice-hidden");if(n){var o=n.getAttribute("data-min-selection"),i=n.getAttribute("data-max-selection");if(o||i){var a=t.querySelector(".srfm-error-message"),l=(null===(e=window)||void 0===e||null===(r=e.srfm_submit)||void 0===r?void 0:r.messages)||{};t.addEventListener("input",(function(){var e,r,s=n.value.split(",").filter(Boolean).length;if(0!==s){var u,c,f=n.closest(".srfm-block"),d="";if(o&&s<o)d=null===(u=window)||void 0===u||null===(c=u.srfm)||void 0===c?void 0:c.srfmSprintfString(l.srfm_multi_choice_min_selections,o);else if(i&&s>i){var m,v;d=null===(m=window)||void 0===m||null===(v=m.srfm)||void 0===v?void 0:v.srfmSprintfString(l.srfm_multi_choice_max_selections,i)}a.textContent=d,null===(e=window)||void 0===e||null===(r=e.srfm)||void 0===r||r.toggleErrorState(f,Boolean(d))}else{var p,h;null===(p=window)||void 0===p||null===(h=p.srfm)||void 0===h||h.toggleErrorState(t,!1)}}))}}}));for(var t=Array.from(document.querySelectorAll(".srfm-form")),e=function(){var t=n[r],e=G(t),o=e.formId,i=e.submitType,a=e.successUrl,l=e.ajaxUrl,s=e.nonce,u=e.loader,c=e.successContainer,f=e.successElement,d=e.recaptchaType,m=e.afterSubmission,v=e.captchaErrorElement,p=e.hCaptchaDiv,h=e.turnstileDiv,y="v2-checkbox"===d||!!p||!!h;t.addEventListener("submit",function(){var e=A(L().mark((function e(r){var n,b,g,w;return L().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r.preventDefault(),"FORM"!==(null==(n=r.target)?void 0:n.tagName)){e.next=9;break}if(b=null==n?void 0:n.closest(".srfm-form-container"),g=null==b?void 0:b.classList.contains("srfm-submit-button-hidden"),w=null==n?void 0:n.querySelector("button.srfm-custom-button"),!g||w){e.next=9;break}return console.warn("Form submission is disabled because the submit button is hidden."),e.abrupt("return");case 9:N(t,o,l,s,u,a,c,f,i,m,y?d:void 0,y?p:void 0,y?h:void 0,y?v:void 0);case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}())},r=0,n=t;r<n.length;r++)e()})),document.addEventListener("srfm_show_common_form_error",(function(t){var e=t.detail||{},r=e.form,n=e.message,o=void 0===n?"":n,i=e.position,a=void 0===i?"footer":i;if(r){var l=o||(0,y.__)("There was an error trying to submit your form. Please try again.","sureforms"),s="header"===a?"srfm-head-error":"srfm-footer-error",u=r.querySelector(".srfm-common-error-message.".concat(s));u&&(u.querySelector(".srfm-error-content").innerHTML=l,u.removeAttribute("hidden"),p({firstErrorInput:u,scrollElement:u}))}})),window.recaptchaCallback=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";Array.from(document.querySelectorAll(".srfm-form")).forEach((function(e){var r=G(e),n=r.formId,o=r.submitType,i=r.successUrl,a=r.ajaxUrl,l=r.nonce,s=r.loader,u=r.successContainer,c=r.successElement,f=r.submitBtn,d=r.siteKey,m=r.recaptchaType,v=r.afterSubmission,p=!1;"v2-invisible"===m&&(grecaptcha.render(f,{sitekey:d,callback:function(){N(e,n,a,l,s,i,u,c,o,v),p=!0}}),f.addEventListener("click",(function(){s.classList.add("srfm-active"),p&&N(e,n,a,l,s,i,u,c,o,v)}))),"v3-reCAPTCHA"===m&&t&&(s.classList.add("srfm-active"),N(e,n,a,l,s,i,u,c,o,v))}))},window.handleBricksPreviewFormSubmission=function(){for(var t=0,e=Array.from(document.querySelectorAll(".srfm-form"));t<e.length;t++)e[t].addEventListener("submit",function(){var t=A(L().mark((function t(e){return L().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e.preventDefault();case 1:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())}})();